package com.liezh.builder.builder;

import com.liezh.builder.builder.product.TeXText;

import java.io.UnsupportedEncodingException;

/**
 * ConcreteBuilder：代表 Builder 类的具体实现类
 */
public class TeXConverter extends TextConverter {

    private TeXText mTeXText = new TeXText();

    public TeXText convertCharacter(String charset) {
        System.out.println("设置TeX文本字符集：" + charset);
        mTeXText.setCharset(charset);
        // TODO 转换content的字符集
        try {
            String content = super.changeCharset(mTeXText.getContent(), charset);
            mTeXText.setContent(content);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return mTeXText;
    }

    public TeXText convertFontChange(String font) {
        System.out.println("更改TeX的字体样式");
        mTeXText.setFont(font);
        return mTeXText;
    }

    public TeXText convertParagraph() {
        System.out.println("段落样式设置，如段距，行高，是否首行缩进等");
        mTeXText.setParagraphStyle("1111");
        return null;
    }

    public TeXText getmTeXText() {
        return this.mTeXText;
    }
}
